package com.wz.utils.generic;

import java.util.Arrays;
import java.util.List;

/**
 * List<? extends Fruit>不能添加，只能添加null
 */
public class CompilerIntelligence {
    public static void main(String[] args) {
        List<? extends Fruit> flist = Arrays.asList(new Apple());
        Apple a = (Apple)flist.get(0); // No warning
        System.out.println(flist.contains(new Apple())); // Argument is ‘Object’
        System.out.println(flist.indexOf(new Apple())); // Argument is ‘Object’
        
        //flist.add(new Apple());   无法编译

    }
}